package com.Demo1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: fzykd
 * Date: 2022-12-04
 * Time: 14:58
 */

//饿汉模式
public class Singleton {
    private static Singleton instance = new Singleton();
    //构造函数防止类外破坏
    private Singleton(){}

    //写一个方法 类外唯一获取的途径
    public static Singleton getInstance(){
        return instance;
    }
}
